package com.sky.controller.user;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController("userShopController")
@RequestMapping("/user/shop")
@Api("店铺控制类")
public class ShopController {
    /**
     * 店铺控制类
     */
    @Autowired
    private RedisTemplate redisTemplate;
    private final static String SHOP_STATUS_KEY = "SHOP_STATUS";
    /**
     * 查询店铺状态接口
     */
    @GetMapping("/status")
    @ApiOperation("查询店铺状态接口")
    public Result<Integer> queryShopStatus(){
        Integer status =(Integer) redisTemplate.opsForValue().get(SHOP_STATUS_KEY);
        log.info("查询店铺状态status:{}",status);
        return Result.success(status);
    }
}
